using System;
using System.Collections.Generic;
using TerritoryGame.Domain.Entities;

namespace TerritoryGame.Domain.Entities.App
{
    public class GameRecord : EntityBase
    {
        public Guid RoomId { get; set; } // Foreign key to GameRoom
        public string RoomName { get; set; }
        public Guid? WinnerId { get; set; } // Foreign key to Player (nullable)
        public string WinnerUsername { get; set; }
        public int PlayerCount { get; set; }
        public int Duration { get; set; } // 游戏时长（分钟）
        public DateTime StartedAt { get; set; }
        public DateTime EndedAt { get; set; }
        public List<PlayerGameResult> PlayerResults { get; set; } = new List<PlayerGameResult>();
        public GameStatus Status { get; set; }
        
        // Navigation properties
        public GameRoom Room { get; set; } = null!;
        public Player? Winner { get; set; } // nullable
    }

    public class PlayerGameResult
    {
        public Guid? PlayerId { get; set; } // Foreign key to Player (nullable)
        public string Username { get; set; }
        public string Color { get; set; }
        public int AreaCount { get; set; }
        public int Rank { get; set; }
        public bool IsWinner { get; set; }
        
        // Navigation property
        public Player? Player { get; set; } // nullable
    }
}
